--[[ja]]
--[[
このスクリーンフィルターは「Default Extended A.C(waiei)」の
フルコンボエフェクトのソースを参考にしました。
]]

local pn = ...
assert(pn);

local t = Def.ActorFrame{};

local IsUsingSoloSingles = PREFSMAN:GetPreference('Center1Player');
local NumPlayers = GAMESTATE:GetNumPlayersEnabled();
local NumSides = GAMESTATE:GetNumSidesJoined();

local function GetPosition(pn)
	if IsUsingSoloSingles and NumPlayers == 1 and NumSides == 1 then return SCREEN_CENTER_X; end;

	local strPlayer = (NumPlayers == 1) and "OnePlayer" or "TwoPlayers";
	local strSide = (NumSides == 1) and "OneSide" or "TwoSides";
	
	return THEME:GetMetric("ScreenGameplay","Player".. pname(pn) .. strPlayer .. strSide .."X");
end;

local function GetFullComboEffectSizeX(pn)
	local r=0;
	local one=THEME:GetMetric("ArrowEffects","ArrowSpacing");
	local stt=GAMESTATE:GetCurrentSteps(pn):GetStepsType();

	if stt=='StepsType_Dance_Single' then
		r=one*4;
	elseif stt=='StepsType_Dance_Double' then
		r=one*8;
	elseif stt=='StepsType_Dance_Couple' then
		r=one*4;
	elseif stt=='StepsType_Dance_Solo' then
		r=one*6;
	elseif stt=='StepsType_Dance_Threepanel' then
		r=one*3;
	else
		r=SCREEN_WIDTH;
	end;
	return r;
end;

local function FullComboColorA(pn)
	local fcacolor = "0,0,0,0";
	local ss = STATSMAN:GetCurStageStats();
	local pss = ss:GetPlayerStageStats(pn);
	if pss:FullComboOfScore('TapNoteScore_W1') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcacolor = "1,1,1,0.5";
	elseif pss:FullComboOfScore('TapNoteScore_W2') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcacolor = "1,0.8,0.2,0.5";
	elseif pss:FullComboOfScore('TapNoteScore_W3') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcacolor = "0,1,0.2,0.5";
		
	else
		fcacolor = "0,0,0,0";
	end;
	return fcacolor;
end;

local function FullComboColorB(pn)
	local fcbcolor = "0,0,0,0";
	local ss = STATSMAN:GetCurStageStats();
	local pss = ss:GetPlayerStageStats(pn);
	if pss:FullComboOfScore('TapNoteScore_W1') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcbcolor = "1,1,1,0.35";
	elseif pss:FullComboOfScore('TapNoteScore_W2') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcbcolor = "1,0.8,0.2,0.35";
	elseif pss:FullComboOfScore('TapNoteScore_W3') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcbcolor = "0,1,0.2,0.35";
		
	else
		fcbcolor = "0,0,0,0";
	end;
	return fcbcolor;
end;

local function FullComboColorC(pn)
	local fcccolor = "0,0,0,0";
	local ss = STATSMAN:GetCurStageStats();
	local pss = ss:GetPlayerStageStats(pn);
	if pss:FullComboOfScore('TapNoteScore_W1') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcccolor = "1,1,1,0.4";
	elseif pss:FullComboOfScore('TapNoteScore_W2') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcccolor = "1,0.8,0.2,0.4";
	elseif pss:FullComboOfScore('TapNoteScore_W3') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcccolor = "0,1,0.2,0.4";
		
	else
		fcccolor = "0,0,0,0";
	end;
	return fcccolor;
end;

local function FullComboColorD(pn)
	local fcdcolor = "0,0,0,0";
	local ss = STATSMAN:GetCurStageStats();
	local pss = ss:GetPlayerStageStats(pn);
	if pss:FullComboOfScore('TapNoteScore_W1') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcdcolor = "1,1,1,0.6";
	elseif pss:FullComboOfScore('TapNoteScore_W2') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcdcolor = "1,0.8,0.2,0.6";
	elseif pss:FullComboOfScore('TapNoteScore_W3') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcdcolor = "0,1,0.2,0.6";
	else
		fcdcolor = "0,0,0,0";
	end;
	return fcdcolor;
end;

local function FullComboColorE(pn)
	local fcecolor = "0,0,0,0";
	local ss = STATSMAN:GetCurStageStats();
	local pss = ss:GetPlayerStageStats(pn);
	if pss:FullComboOfScore('TapNoteScore_W1') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcecolor = "1,1,1,0";
	elseif pss:FullComboOfScore('TapNoteScore_W2') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcecolor = "1,0.8,0.2,0";
	elseif pss:FullComboOfScore('TapNoteScore_W3') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcecolor = "0,1,0.2,0";
	else
		fcecolor = "0,0,0,0";
	end;
	return fcecolor;
end;

local function FullComboColorF(pn)
	local fcfcolor = "0,0,0,0";
	local ss = STATSMAN:GetCurStageStats();
	local pss = ss:GetPlayerStageStats(pn);
	if pss:FullComboOfScore('TapNoteScore_W1') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcfcolor = "1,1,1,0.75";
	elseif pss:FullComboOfScore('TapNoteScore_W2') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcfcolor = "1,0.8,0.2,0.75";
	elseif pss:FullComboOfScore('TapNoteScore_W3') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcfcolor = "0,1,0.2,0.75";
	else
		fcfcolor = "0,0,0,0";
	end;
	return fcfcolor;
end;

local function FullComboColorG(pn)
	local fcgcolor = "0,0,0,0";
	local ss = STATSMAN:GetCurStageStats();
	local pss = ss:GetPlayerStageStats(pn);
	if pss:FullComboOfScore('TapNoteScore_W1') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcgcolor = "1,1,1,1";
	elseif pss:FullComboOfScore('TapNoteScore_W2') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcgcolor = "1,0.8,0.2,1";
	elseif pss:FullComboOfScore('TapNoteScore_W3') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
		fcgcolor = "0,1,0.2,1";
	else
		fcgcolor = "0,0,0,0";
	end;
	return fcgcolor;
end;



t[#t+1] = Def.ActorFrame{
	InitCommand=function(self)
		if GAMESTATE:PlayerIsUsingModifier(pn,"no little") == true and GAMESTATE:PlayerIsUsingModifier(pn,"no nofakes") == true and GAMESTATE:PlayerIsUsingModifier(pn,"no nohands") == true and GAMESTATE:PlayerIsUsingModifier(pn,"no noholds") == true and GAMESTATE:PlayerIsUsingModifier(pn,"no nojumps") == true and GAMESTATE:PlayerIsUsingModifier(pn,"no nolifts") == true and GAMESTATE:PlayerIsUsingModifier(pn,"no nomines") == true and GAMESTATE:PlayerIsUsingModifier(pn,"no noquads") == true and GAMESTATE:PlayerIsUsingModifier(pn,"no norolls") == true and GAMESTATE:PlayerIsUsingModifier(pn,"no nostretch") == true and GAMESTATE:PlayerIsUsingModifier(pn,"no autoplay") == true and GAMESTATE:PlayerIsUsingModifier(pn,"no assisttick") == true then
			self:visible(true);
		else
			self:visible(false);
		end;
	end;

	Def.Quad {
		InitCommand=cmd(shadowlength,0;draworder,102);
		BeginCommand=function(self)
			self:diffusealpha(0);
			self:x( GetPosition(pn) );
			self:y(SCREEN_BOTTOM);
			self:vertalign(bottom);
		end;
		OffCommand=function(self)
			local ss = STATSMAN:GetCurStageStats();
			if not ss:AllFailed() then
				local pss = ss:GetPlayerStageStats(pn);
				local tnsComboThreshold = THEME:GetMetric("Gameplay","MinScoreToContinueCombo");
				if (pss:FullComboOfScore('TapNoteScore_W1') == true or pss:FullComboOfScore('TapNoteScore_W2') == true or pss:FullComboOfScore('TapNoteScore_W3') == true) and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
					self:visible(true);
					self:zoomtowidth(0);
					self:zoomtoheight(0);
					self:diffuse(color(FullComboColorA(pn)));
					self:zoomtoheight(SCREEN_HEIGHT/9.5);
					self:accelerate(0.2);
					self:zoomtowidth(GetFullComboEffectSizeX(pn)*1.25);
					self:linear(0.25);
					self:zoomtoheight(SCREEN_HEIGHT);
					self:diffusealpha(0.5);
					self:linear(0.25);
					self:diffusealpha(0);
				else
					self:visible(false);
				end;
			else
				self:visible(false);
			end;
		end;
	};
	
	Def.Quad {
		InitCommand=cmd(shadowlength,0;draworder,103);
		BeginCommand=function(self)
			self:diffusealpha(0);
			self:x( GetPosition(pn) );
			self:y(SCREEN_BOTTOM);
			self:vertalign(bottom);
			self:blend('BlendMode_Add');
		end;
		OffCommand=function(self)
			local ss = STATSMAN:GetCurStageStats();
			if not ss:AllFailed() then
				local pss = ss:GetPlayerStageStats(pn);
				local tnsComboThreshold = THEME:GetMetric("Gameplay","MinScoreToContinueCombo");
				if (pss:FullComboOfScore('TapNoteScore_W1') == true or pss:FullComboOfScore('TapNoteScore_W2') == true or pss:FullComboOfScore('TapNoteScore_W3') == true) and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
					self:visible(true);
					self:zoomtowidth(0);
					self:zoomtoheight(0);
					self:diffuse(color(FullComboColorB(pn)));
					self:zoomtoheight(SCREEN_HEIGHT/8);
					self:accelerate(0.3);
					self:zoomtowidth(GetFullComboEffectSizeX(pn)*1.25);
					self:linear(0.7);
					self:zoomtoheight(SCREEN_HEIGHT);
					self:diffusealpha(0);
				else
					self:visible(false);
				end;
			else
				self:visible(false);
			end;
		end;
	};
	
	Def.Quad {
		InitCommand=cmd(shadowlength,0;draworder,104);
		BeginCommand=function(self)
			self:diffusealpha(0);
			self:x( GetPosition(pn) );
			self:y(SCREEN_CENTER_Y);
		end;
		OffCommand=function(self)
			local ss = STATSMAN:GetCurStageStats();
			if not ss:AllFailed() then
				local pss = ss:GetPlayerStageStats(pn);
				local tnsComboThreshold = THEME:GetMetric("Gameplay","MinScoreToContinueCombo");
				if (pss:FullComboOfScore('TapNoteScore_W1') == true or pss:FullComboOfScore('TapNoteScore_W2') == true or pss:FullComboOfScore('TapNoteScore_W3') == true) and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
					self:visible(true);
					self:diffusealpha(0);
					self:sleep(0.9);
					self:diffuse(color(FullComboColorB(pn)));
					self:zoomtowidth(GetFullComboEffectSizeX(pn)*0.5);
					self:zoomtoheight(SCREEN_HEIGHT);
					self:accelerate(0.25);
					self:zoomtowidth(GetFullComboEffectSizeX(pn)*0.2);
					self:addx(-100)
					self:diffusealpha(0);
				else
					self:visible(false);
				end;
			else
				self:visible(false);
			end;
		end;
	};
	
	Def.Quad {
		InitCommand=cmd(shadowlength,0;draworder,105);
		BeginCommand=function(self)
			self:diffusealpha(0);
			self:x( GetPosition(pn) );
			self:y(SCREEN_CENTER_Y);
		end;
		OffCommand=function(self)
			local ss = STATSMAN:GetCurStageStats();
			if not ss:AllFailed() then
				local pss = ss:GetPlayerStageStats(pn);
				local tnsComboThreshold = THEME:GetMetric("Gameplay","MinScoreToContinueCombo");
				if (pss:FullComboOfScore('TapNoteScore_W1') == true or pss:FullComboOfScore('TapNoteScore_W2') == true or pss:FullComboOfScore('TapNoteScore_W3') == true) and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
					self:visible(true);
					self:diffusealpha(0);
					self:sleep(0.9);
					self:diffuse(color(FullComboColorB(pn)));
					self:zoomtowidth(GetFullComboEffectSizeX(pn)*0.5);
					self:zoomtoheight(SCREEN_HEIGHT);
					self:accelerate(0.25);
					self:zoomtowidth(GetFullComboEffectSizeX(pn)*0.2);
					self:addx(100)
					self:diffusealpha(0);
				else
					self:visible(false);
				end;
			else
				self:visible(false);
			end;
		end;
	};

	Def.Quad {
		InitCommand=cmd(shadowlength,0;draworder,106);
		BeginCommand=function(self)
			self:diffusealpha(0);
			self:x( GetPosition(pn) );
			self:y(SCREEN_CENTER_Y);
		end;
		OffCommand=function(self)
			local ss = STATSMAN:GetCurStageStats();
			if not ss:AllFailed() then
				local pss = ss:GetPlayerStageStats(pn);
				local tnsComboThreshold = THEME:GetMetric("Gameplay","MinScoreToContinueCombo");
				if (pss:FullComboOfScore('TapNoteScore_W1') == true or pss:FullComboOfScore('TapNoteScore_W2') == true or pss:FullComboOfScore('TapNoteScore_W3') == true) and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
					self:visible(true);
					self:zoomtowidth(0);
					self:zoomtoheight(SCREEN_HEIGHT);
					self:diffuse(color(FullComboColorA(pn)));
					self:sleep(0.5)
					self:diffusealpha(1);
					self:linear(0.5);
					self:zoomtowidth(SCREEN_WIDTH/2);
					self:diffusealpha(0);
				else
					self:visible(false);
				end;
			else
				self:visible(false);
			end;
		end;
	};
	
	Def.Quad {
		InitCommand=cmd(shadowlength,0;draworder,107);
		BeginCommand=function(self)
			self:diffusealpha(0);
			self:x( GetPosition(pn) );
			self:y(SCREEN_CENTER_Y);
			self:blend('BlendMode_Add');
		end;
		OffCommand=function(self)
			local ss = STATSMAN:GetCurStageStats();
			if not ss:AllFailed() then
				local pss = ss:GetPlayerStageStats(pn);
				local tnsComboThreshold = THEME:GetMetric("Gameplay","MinScoreToContinueCombo");
				if (pss:FullComboOfScore('TapNoteScore_W1') == true or pss:FullComboOfScore('TapNoteScore_W2') == true or pss:FullComboOfScore('TapNoteScore_W3') == true) and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
					self:visible(true);
					self:diffusealpha(1);
					self:zoomtowidth(0);
					self:zoomtoheight(0);
					self:accelerate(0.25);
					self:zoomtoheight(SCREEN_HEIGHT);
					self:diffuse(color(FullComboColorC(pn)));
					self:accelerate(0.75);
					self:zoomtowidth(SCREEN_WIDTH/2.25);
					self:diffusealpha(0);
				else
					self:visible(false);
				end;
			else
				self:visible(false);
			end;
		end;
	};
	
	LoadActor(THEME:GetPathB("","graph"))..{
		InitCommand=cmd(shadowlength,4;draworder,108);
		BeginCommand=function(self)
			self:diffusealpha(0);
			self:x( GetPosition(pn) );
			self:y(SCREEN_CENTER_Y);
		end;
		OffCommand=function(self)
			local ss = STATSMAN:GetCurStageStats();
			if not ss:AllFailed() then
				local pss = ss:GetPlayerStageStats(pn);
				local tnsComboThreshold = THEME:GetMetric("Gameplay","MinScoreToContinueCombo");
				if (pss:FullComboOfScore('TapNoteScore_W1') == true or pss:FullComboOfScore('TapNoteScore_W2') == true or pss:FullComboOfScore('TapNoteScore_W3') == true) and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
					self:visible(true);
					self:addx(40);
					self:addy(20);
					self:zoom(0);
					self:linear(0.5);
					self:diffusealpha(0.7);
					self:glow(color(FullComboColorD(pn)));
					self:zoom(0.75);
					self:rotationy(-30);
					self:rotationx(70);
					self:rotationz(200);
					self:linear(0.5);
					self:glow(color(FullComboColorE(pn)));
					self:rotationz(400);
					self:linear(0.05);
					self:zoomx(5);
					self:diffusealpha(0);
				else
					self:visible(false);
				end;
			else
				self:visible(false);
			end;
		end;
	};
	
	LoadActor(THEME:GetPathB("","graph"))..{
		InitCommand=cmd(shadowlength,4;draworder,109);
		BeginCommand=function(self)
			self:diffusealpha(0);
			self:x( GetPosition(pn) );
			self:y(SCREEN_CENTER_Y);
		end;
		OffCommand=function(self)
			local ss = STATSMAN:GetCurStageStats();
			if not ss:AllFailed() then
				local pss = ss:GetPlayerStageStats(pn);
				local tnsComboThreshold = THEME:GetMetric("Gameplay","MinScoreToContinueCombo");
				if pss:FullComboOfScore('TapNoteScore_W1') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
					self:visible(true);
					self:addx(40);
					self:addy(20);
					self:zoom(0);
					self:linear(0.5);
					self:diffusealpha(0.7);
					self:glow(color("1,1,1,0.6"));
					self:zoom(0.75);
					self:rotationy(30);
					self:rotationx(70);
					self:rotationz(100);
					self:linear(0.5);
					self:rotationy(60);
					self:rotationx(-100);
					self:rotationz(200);
					self:glow(color("1,1,1,0"));
					self:linear(0.05);
					self:zoomx(5);
					self:diffusealpha(0);
				elseif pss:FullComboOfScore('TapNoteScore_W2') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
					self:visible(true);
					self:addx(40);
					self:addy(20);
					self:zoom(0);
					self:linear(0.5);
					self:diffusealpha(0.7);
					self:glow(color("1,0.8,0,1"));
					self:zoom(0.75);
					self:rotationy(30);
					self:rotationx(70);
					self:rotationz(100);
					self:linear(0.5);
					self:rotationy(60);
					self:rotationx(-100);
					self:rotationz(200);
					self:glow(color("1,0.8,0,0"));
					self:linear(0.05);
					self:zoomx(5);
					self:diffusealpha(0);
				elseif pss:FullComboOfScore('TapNoteScore_W3') == true and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
					self:visible(true);
					self:addx(40);
					self:addy(20);
					self:zoom(0);
					self:linear(0.5);
					self:diffusealpha(0.7);
					self:glow(color("0,1,0.2,1"));
					self:zoom(0.75);
					self:rotationy(30);
					self:rotationx(70);
					self:rotationz(100);
					self:linear(0.5);
					self:rotationy(60);
					self:rotationx(-100);
					self:rotationz(200);
					self:glow(color("0,1,0.2,0"));
					self:linear(0.05);
					self:zoomx(5);
					self:diffusealpha(0);
				end;
			else
				self:visible(false);
			end;
		end;
	};

	LoadActor(THEME:GetPathG("","combo01"))..{
		InitCommand=cmd(shadowlength,0;draworder,110);
		BeginCommand=function(self)
			self:diffusealpha(0);
			self:x( GetPosition(pn) );
			self:y(SCREEN_CENTER_Y);
			self:blend('BlendMode_Add');
		end;
		OffCommand=function(self)
			local ss = STATSMAN:GetCurStageStats();
			if not ss:AllFailed() then
				local pss = ss:GetPlayerStageStats(pn);
				local tnsComboThreshold = THEME:GetMetric("Gameplay","MinScoreToContinueCombo");
				if (pss:FullComboOfScore('TapNoteScore_W1') == true or pss:FullComboOfScore('TapNoteScore_W2') == true or pss:FullComboOfScore('TapNoteScore_W3') == true) and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
					self:visible(true);
					self:glow(color(FullComboColorF(pn)));
					self:accelerate(0.25);
					self:diffusealpha(0.7);
					self:zoom(0);
					self:accelerate(1);
					self:glow(color(FullComboColorE(pn)));
					self:zoom(2);
					self:diffusealpha(0);
				else
					self:visible(false);
				end;
			else
				self:visible(false);
			end;
		end;
	};

	LoadActor(THEME:GetPathG("","combo01"))..{
		InitCommand=cmd(shadowlength,4;draworder,111);
		BeginCommand=function(self)
			self:diffusealpha(0);
			self:x( GetPosition(pn) );
			self:y(SCREEN_CENTER_Y);
		end;
		OffCommand=function(self)
			local ss = STATSMAN:GetCurStageStats();
			if not ss:AllFailed() then
				local pss = ss:GetPlayerStageStats(pn);
				local tnsComboThreshold = THEME:GetMetric("Gameplay","MinScoreToContinueCombo");
				if (pss:FullComboOfScore('TapNoteScore_W1') == true or pss:FullComboOfScore('TapNoteScore_W2') == true or pss:FullComboOfScore('TapNoteScore_W3') == true) and pss:GetTapNoteScores('TapNoteScore_HitMine') == 0 then
					self:visible(true);
					self:accelerate(0.25);
					self:diffusealpha(0.7);
					self:glow(color(FullComboColorF(pn)));
					self:zoom(1.5);
					self:decelerate(0.75);
					self:glow(color(FullComboColorE(pn)));
					self:diffuse(color(FullComboColorG(pn)));
					self:zoom(1);
					self:sleep(0.5);
					self:linear(0.1);
					self:zoomx(5);
					self:diffusealpha(0);
				else
					self:visible(false);
				end;
			else
				self:visible(false);
			end;
		end;
	};

};

return t;